package com.sxt.springcloud.opd.fallback;

import com.sxt.opd.vo.GuahaoVo;
import com.sxt.springcloud.opd.GuahaoClientService;
import com.sxt.sys.common.DataGridView;
import com.sxt.sys.common.ResultObj;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class GuahaoClientFallbackService implements FallbackFactory {
    @Override
    public Object create(Throwable throwable) {
        return new GuahaoClientService() {
            @Override
            public DataGridView loadAllGuahao(GuahaoVo guahaoVo) {
                return new DataGridView("服务降级，服务器忙，请稍后重试！调用查询所有挂号方法失败");
            }

            @Override
            public ResultObj addGuahao(GuahaoVo guahaoVo, String userName) {
                return ResultObj.SERVER_BUSY;
            }

            @Override
            public ResultObj updateGuahao(GuahaoVo guahaoVo) {
                return ResultObj.SERVER_BUSY;
            }

            @Override
            public ResultObj deleteGuahao(Integer id) {
                return ResultObj.SERVER_BUSY;
            }
        };
    }
}
